<?php 

?>
<tr class="items" style="">
	<td class="first left" style="overflow:hidden;"><?php echo ucfirst($item->getIsBuyingText()); ?>&nbsp;/&nbsp;<?php echo $txt->truncate($item->getCatTitle(), 10); ?>&nbsp;&nbsp;</td>
	<td class="left"><a href="<?php echo $item->getLink(); ?>"><?php echo $item->getId(); ?></a>&nbsp;&nbsp;</td>
	<td class="left"><a title="<?php echo $item->getTitle(); ?>" href="<?php echo $item->getLink(); ?>"><?php echo $txt->truncate($item->getTitle(), 12); ?></a>&nbsp;&nbsp;</td>
	<td class="left"><?php echo $item->getViewsDetail(); ?></td>
	<td class="left nowrap"><?php echo $item->formatDateTime($item->getDateCreated(), 'd.m.y'); ?>&nbsp;&nbsp;</td>
	<td class="left nowrap <?php if(strtotime($item->getDateActiveEnd()) < $nextWeek) { echo 'red'; }?>">
		<?php if($item->getDateActiveEnd() != '0000-00-00 00:00:00') { echo $item->formatDateTime($item->getDateActiveEnd(), 'd.m.y'); } ?>&nbsp;&nbsp;
	</td>
	<td class="left">
		<?php 
		if($display['status'] == 0)
		{ echo ucfirst($txt->getWord('new')).'&nbsp;&nbsp;'; }
		if($display['status'] == 1)
		{
			if($item->getIsCompleted() > 0)
			{ echo ucfirst($txt->truncate($item->getIsBoughtText(), 10, '', '', '')); }
			else
			{ 
				echo ucfirst($txt->getWord('published')).'&nbsp;&nbsp;';
				//echo $item->formatDateTime($item->getDateActiveStart(), 'd.m.Y').'&nbsp;'; 
			}
		}
		if($display['status'] == 2)
		{
			if(strtotime($item->getDateActiveEnd()) < time())
			{ echo ucfirst($txt->getWord('expired')).'&nbsp;&nbsp;'; }
			if($item->getArchived() > 0)
			{ echo ucfirst($txt->getWord('archived')).'&nbsp;&nbsp;'; }
		}
		?>
	</td>
	<td class="left">
	<?php 
	if($display['status'] == 0)
	{ 
		if($item->getIsValid() > 0)
		{
			if($item->getIsPaid() > 0)
			{ 
				echo '<a href="/c/'.$com->getComId().'/?list=ad&activate='.$item->getId().'">';
				echo ucfirst($txt->getWord('publish'));
				echo '</a>&nbsp;|&nbsp;';
			}
			else
			{ 
				echo '<a href="/c/'.$com->getComId().'/?edit=payment&amp;ad='.$item->getId().'">';
				echo ucfirst($txt->getWord('pay'));
				echo '</a>&nbsp;|&nbsp;'; 
			}
		}
		else
		{
			echo '<a href="/c/'.$com->getComId().'/?edit=ad&amp;ad='.$item->getId().'">';
			echo ucfirst($txt->getWord('edit'));
			echo '</a>&nbsp;|&nbsp;';
		}
	}
	
	if(($display['status'] == 1) && ($item->getIsPaid() > 0))
	{
		if($item->getIsCompleted() > 0)
		{
			echo '<a href="/c/'.$com->getComId().'/?list=ad&uncomplete='.$item->getId().'">';
			echo ucfirst($txt->getWord('set_as').' '.$item->getIsBuyingText());
			echo '</a>&nbsp;|&nbsp;';
		}
		else
		{
			if((strtotime($item->getDateActiveEnd()) < $nextWeek) /*|| ($user->getPartnerStatus() > 2)*/)
			{ 
				echo '<a href="/c/'.$com->getComId().'/?edit=ad&amp;ad='.$item->getId().'&amp;display=renew" class="command">';
				//echo '<a id="renew_ad_'.$item->getId().'_link" onclick="renewAdDialog('.$item->getId().');" class="command">';
				echo ucfirst($txt->getWord('renew'));
				echo '</a>&nbsp;|&nbsp;';
			}
			
			echo '<a href="/c/'.$com->getComId().'/?list=ad&complete='.$item->getId().'">';
			echo ucfirst($txt->getWord('set_as').' '.$item->getIsBoughtText());
			echo '</a>&nbsp;|&nbsp;';
		}
	}
	
	if($display['status'] == 2)
	{
		
		if(strtotime($item->getDateActiveEnd()) < $nextWeek)
		{ 
			//echo '<a id="renew_ad_'.$item->getId().'_link" onclick="renewAdDialog('.$item->getId().');" class="command">';
			echo '<a href="/c/'.$com->getComId().'/?edit=ad&amp;ad='.$item->getId().'&amp;display=renew">';
			echo ucfirst($txt->getWord('renew'));
			echo '</a>&nbsp;|&nbsp;';
		}
		
		if($adc->getSetting('UserAdArchive') > 0)
		{
			if($item->getArchived() > 0)
			{ 
				echo '<a href="/c/'.$com->getComId().'/?list=ad&unarchive='.$item->getId().'">';
				echo ucfirst($txt->getWord('restore'));
				echo '</a>&nbsp;|&nbsp;';
			}
			else
			{ 
				echo '<a href="/c/'.$com->getComId().'/?list=ad&archive='.$item->getId().'">';
				echo ucfirst($txt->getWord('archive'));
				echo '</a>&nbsp;|&nbsp;';
			}
		}
	}
	
	if($item->getIsDeletable())
	{
		echo '<a id="del_ad_'.$item->getId().'" class="deleteAdButton" rel="'.$item->getId().'" class="icon command pointer">';
		echo ucfirst($txt->getWord('delete'));
		echo '</a>';
	}
	?>&nbsp;&nbsp;&nbsp;&nbsp;
	</td>
	<td class="right nowrap">
		<a href="/c/<?php echo $com->getComId(); ?>?edit=ad&amp;ad=<?php echo $item->getId() ?>"><img title="<?php echo ucfirst($txt->getWord('edit').' '.$txt->getWord('ad')); ?>" class="icon command" src="<?php echo SYSICONS_URL; ?>edit_16.gif" /></a>&nbsp;&nbsp;
		<a href="/c/<?php echo $com->getComId(); ?>?edit=ad&amp;ad=<?php echo $item->getId() ?>&amp;view=images"><img title="<?php echo ucfirst($txt->getWord('edit').' '.$txt->getWord('images')); ?>" class="icon command" src="<?php echo SYSICONS_URL; ?>images_16.png" /></a>
		<?php 
		
		//if(($display['status'] > 0) && (/*($user->getPartnerStatus() > 2) || */(strtotime($item->getDateActiveEnd()) < $nextWeek)))
		//{
		//	echo '&nbsp;&nbsp;<a href="/c/'.$com->getComId().'/?edit=ad&amp;ad='.$item->getId().'&amp;display=renew">';
			//echo '&nbsp;&nbsp;<a id="renew_ad_'.$item->getId().'" onclick="renewAdDialog('.$item->getId().');" class="command">';
		//	echo '<img class="icon command" title="'.ucfirst($txt->getWord('renew')).'" class="icon command" src="'.SYSICONS_URL.'refresh_16.gif" /></a>';
		//}
		if($item->getActive() > 0)
		{ 
			if($item->getArchived() == 0)
			{ 
				echo '&nbsp;&nbsp;<a href="/c/'.$com->getComId().'/?list=ad&archive='.$item->getId().'"><img title="'.ucfirst($txt->getWord('archive').' '.$txt->getWord('ad')).'" class="icon command" src="'.SYSICONS_URL.'archive_16.png" /></a>'; 
			}
			else
			{
				echo '&nbsp;&nbsp;<a href="/c/'.$com->getComId().'/?list=ad&unarchive='.$item->getId().'"><img title="'.ucfirst($txt->getWord('restore')).'" class="icon command" src="'.SYSICONS_URL.'unarchive_16.png" /></a>'; 
				
			}
		}
		if(($display['delete'] > 0) && ($item->getIsDeletable() > 0))
		{ 
			echo '&nbsp;&nbsp;<a id="del_ad_'.$item->getId().'_img" class="deleteAdButton" rel="'.$item->getId().'" class="command"><img class="icon command" title="'.ucfirst($txt->getWord('delete').' '.$txt->getWord('ad')).'" class="icon command" src="'.SYSICONS_URL.'delete_16.png" /></a>';
		}
		?>&nbsp;&nbsp;
	</td>
</tr>